from main.model.logic.pcb import PCB
from main.model.logic.context import Context
from main.model.devices.memory.memory_block import MemoryBlock

class PCBBuilder(object):
    
    def __init__(self, program_name, start=0, end=5):
        self.__program_name = program_name
        self.__start = start
        self.__end = end
        self.__inner_priority = 0
        
    def build(self):
        pcb = PCB(self.__program_name, self.__inner_priority)
        context = Context(MemoryBlock(self.__start, self.__end))
        pcb.context = context
        context.pcb = pcb
        return pcb